package com.ksoap;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

public class Test1 {
	
	public void Test1() throws Exception{
		String url = "http://localhost:8080/wsService/services/DanielService?wsdl";

		HttpTransportSE trans = new HttpTransportSE(url);
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
		SoapObject body = new SoapObject("http://com", "Work");
		body.addProperty("s", "Deenl");
		envelope.setOutputSoapObject(body);

		trans.call("http://com/Work", envelope);
		SoapObject rs = (SoapObject) envelope.bodyIn;
		int m = rs.getPropertyCount();
		for(int i = 0;i<m;i++){
			System.out.println(rs.getProperty(i));
		}
	}
	
	public static void main(String[] args) throws Exception {
		String url = "http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl";
		
		HttpTransportSE trans = new HttpTransportSE(url);
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
		SoapObject body = new SoapObject("http://WebXml.com.cn/", "getRegionProvince");
		envelope.setOutputSoapObject(body);
		
		trans.call("http://WebXml.com.cn/getRegionProvince", envelope);

		SoapObject rs = (SoapObject) envelope.bodyIn;
		SoapObject rs2 = (SoapObject) rs.getProperty(0);
		int m = rs2.getPropertyCount();
		for (int i=0;i<m;i++){
			System.out.println(rs2.getProperty(i));
		}
		//System.out.println(m);
		
		
	}

}
